import { Controller, Get, Post, Body, HttpCode, Response, Query, Header } from '@nestjs/common';
import { RoleService as Service } from '../../services/role/role.service';

@Controller('role')
export class RoleController {

    constructor(private readonly service: Service) { }

    /**
     * 查询列表
     * @param query 
     */
    @Get()
    async getAll(@Query() query): Promise<any> {
        return this.service.findAll({});
    }

    /**
    * 查看角色下的权限
    */
    @Post('/getrole')
    async getPermission(@Body() body): Promise<any> {
        return this.service.add(body);
    }

    /**
     * 添加
     */
    @Post('/add')
    async add(@Body() body): Promise<any> {
        return this.service.add(body);
    }

    /**
     * 修改
     */
    @Post('/update')
    async update(@Body() body): Promise<any> {
        return this.service.update(body);
    }

    /**
     * 删除
     */
    @Post('/delete')
    async delete(@Body() body): Promise<any> {
        return this.service.delete(body);
    }
}
